﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;

namespace OneStop.UI
{
    [Serializable()]
    public class RecentFile
    {
        public RecentFile()
        {

        }

        public RecentFile(string path)
        {
            this.Path = path;
        }

        public string Path { get; set; }

        public string FileName
        {
            get
            {
                if (Path == null)
                {
                    return null; 
                }

                string[] split = Path.Split('\\');

                return split[split.Length - 1];
            }
        }
    }

    [Serializable()]
    public class RecentFileCollection : List<RecentFile>
    {
        public void AddPath(string path)
        {
            var results = from x in this
                          where x.Path == path
                          select x;

            if (results.ToList<RecentFile>().Count == 0)
            {
                this.Add(new RecentFile(path));
            }
        }
    }
}
